<template>
  <div class="home">
<!-- <van-button type="primary">主要按钮</van-button> -->
    <img src="../assets/images/登录页-1.jpg" alt="" width="100%" height="100%">
    <div class="home_button">
      <div class="input">账户 <input type="text" v-model="zhanghao"></div>
      <div class="input">密码 <input type="password" v-model="mima"></div>
      <van-button round type="info" @click="denglu">立即登录</van-button>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src

import {homelogin} from '../requset/api'
export default {
  name: 'Home',
  data(){
    return {
      //账号值
      zhanghao:'13000000000',
      //密码值
      mima:'123456'
    }
  },
  components: {

  },
  methods:{
    denglu(){
      if(this.zhanghao.length == 0||this.mima.length==0){
         this.$toast.fail('账号和密码不能为空');
         return
      }else{
        homelogin({
       "username":this.zhanghao,
        "password":this.mima
     }).then(res=>{
      //  console.log(res);
      //  console.log(res.errCode);
       if(res.errCode==0){
        this.zhanghao=''
        this.mima=''
       localStorage.setItem('token',res.data);
       this.$router.push('/PersonalCenter')
       }
     })
      }
    }
  }
}
</script>
<style lang="less" scoped>
.home{
  position: relative;
  .home_button{
    position: absolute;
    left: 50%;
    top: 380px;
    transform: translateX(-50%);
      .input{
        display: flex;
        margin-bottom: 20px;
        background:#ffcc33 ;
        height: 33px;
        width: 220px;
        border-radius:20px ;
        overflow: hidden;
        line-height: 33px;
        padding-left: 10px;
        box-sizing: border-box;
        font-weight: 700;
        border: 1px solid #000;
        input{
          width: 70%;
          border: none;
          background:#ffcc33 ;
        }
    }
    .van-button{
      width: 155px;
      height: 42px;
      border: 1px solid #000;
      margin-left: 28px;
      margin-top: 50px;
    }
  }
}

</style>